import 'package:base_flutter/base_flutter.dart';

/// bindSiteId : null
/// bindUseType : null
/// bindUseTypeName : null
/// canSkipSelect : false
/// canUseSiteList : [{"menuId":1412,"menuName":"周菜单11.13-11.19(900)配送","siteId":10,"siteName":"AB套餐"},{"menuId":1414,"menuName":"周菜单11.13-11.19(900)配送","siteId":9,"siteName":"周菜单场所"}]
/// createdByName : null
/// elderHumanId : 5
/// elderHumanName : "超级管理员"
/// endValidDate : null
/// havePackage : false
/// isSync : null
/// isSyncName : null
/// nurseLevelName : null
/// packageConfId : null
/// packageConfName : null
/// packageLabel : null
/// packageLabelName : null
/// roomInfo : null
/// startValidDate : null
/// statusMasterId : null
/// statusMasterIdName : null
/// updatedByName : null

class ElderWeekBindInfo {
  ElderWeekBindInfo({
      this.bindSiteId, 
      this.bindUseType, 
      this.bindUseTypeName, 
      this.canSkipSelect, 
      this.canUseSiteList, 
      this.createdByName, 
      this.elderHumanId, 
      this.elderHumanName, 
      this.endValidDate, 
      this.havePackage, 
      this.isSync, 
      this.isSyncName, 
      this.nurseLevelName, 
      this.packageConfId, 
      this.packageConfName, 
      this.packageLabel, 
      this.packageLabelName, 
      this.roomInfo, 
      this.startValidDate, 
      this.statusMasterId, 
      this.statusMasterIdName, 
      this.updatedByName,});

  ElderWeekBindInfo.fromJson(dynamic json) {
    bindSiteId = json['bindSiteId'];
    bindUseType = json['bindUseType'];
    bindUseTypeName = json['bindUseTypeName'];
    canSkipSelect = json['canSkipSelect'];
    if (json['canUseSiteList'] != null) {
      canUseSiteList = [];
      json['canUseSiteList'].forEach((v) {
        canUseSiteList?.add(CanUseSiteList.fromJson(v));
      });
    }
    createdByName = json['createdByName'];
    elderHumanId = json['elderHumanId'];
    elderHumanName = json['elderHumanName'];
    endValidDate = json['endValidDate'];
    havePackage = json['havePackage'];
    isSync = json['isSync'];
    isSyncName = json['isSyncName'];
    nurseLevelName = json['nurseLevelName'];
    packageConfId = json['packageConfId'];
    packageConfName = json['packageConfName'];
    packageLabel = json['packageLabel'];
    packageLabelName = json['packageLabelName'];
    roomInfo = json['roomInfo'];
    startValidDate = json['startValidDate'];
    statusMasterId = json['statusMasterId'];
    statusMasterIdName = json['statusMasterIdName'];
    updatedByName = json['updatedByName'];
  }
  dynamic bindSiteId;
  dynamic bindUseType;
  dynamic bindUseTypeName;
  bool? canSkipSelect;
  List<CanUseSiteList>? canUseSiteList;
  dynamic createdByName;
  num? elderHumanId;
  String? elderHumanName;
  dynamic endValidDate;
  bool? havePackage;
  dynamic isSync;
  dynamic isSyncName;
  dynamic nurseLevelName;
  dynamic packageConfId;
  dynamic packageConfName;
  dynamic packageLabel;
  dynamic packageLabelName;
  dynamic roomInfo;
  dynamic startValidDate;
  dynamic statusMasterId;
  dynamic statusMasterIdName;
  dynamic updatedByName;
ElderWeekBindInfo copyWith({  dynamic bindSiteId,
  dynamic bindUseType,
  dynamic bindUseTypeName,
  bool? canSkipSelect,
  List<CanUseSiteList>? canUseSiteList,
  dynamic createdByName,
  num? elderHumanId,
  String? elderHumanName,
  dynamic endValidDate,
  bool? havePackage,
  dynamic isSync,
  dynamic isSyncName,
  dynamic nurseLevelName,
  dynamic packageConfId,
  dynamic packageConfName,
  dynamic packageLabel,
  dynamic packageLabelName,
  dynamic roomInfo,
  dynamic startValidDate,
  dynamic statusMasterId,
  dynamic statusMasterIdName,
  dynamic updatedByName,
}) => ElderWeekBindInfo(  bindSiteId: bindSiteId ?? this.bindSiteId,
  bindUseType: bindUseType ?? this.bindUseType,
  bindUseTypeName: bindUseTypeName ?? this.bindUseTypeName,
  canSkipSelect: canSkipSelect ?? this.canSkipSelect,
  canUseSiteList: canUseSiteList ?? this.canUseSiteList,
  createdByName: createdByName ?? this.createdByName,
  elderHumanId: elderHumanId ?? this.elderHumanId,
  elderHumanName: elderHumanName ?? this.elderHumanName,
  endValidDate: endValidDate ?? this.endValidDate,
  havePackage: havePackage ?? this.havePackage,
  isSync: isSync ?? this.isSync,
  isSyncName: isSyncName ?? this.isSyncName,
  nurseLevelName: nurseLevelName ?? this.nurseLevelName,
  packageConfId: packageConfId ?? this.packageConfId,
  packageConfName: packageConfName ?? this.packageConfName,
  packageLabel: packageLabel ?? this.packageLabel,
  packageLabelName: packageLabelName ?? this.packageLabelName,
  roomInfo: roomInfo ?? this.roomInfo,
  startValidDate: startValidDate ?? this.startValidDate,
  statusMasterId: statusMasterId ?? this.statusMasterId,
  statusMasterIdName: statusMasterIdName ?? this.statusMasterIdName,
  updatedByName: updatedByName ?? this.updatedByName,
);
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['bindSiteId'] = bindSiteId;
    map['bindUseType'] = bindUseType;
    map['bindUseTypeName'] = bindUseTypeName;
    map['canSkipSelect'] = canSkipSelect;
    if (canUseSiteList != null) {
      map['canUseSiteList'] = canUseSiteList?.map((v) => v.toJson()).toList();
    }
    map['createdByName'] = createdByName;
    map['elderHumanId'] = elderHumanId;
    map['elderHumanName'] = elderHumanName;
    map['endValidDate'] = endValidDate;
    map['havePackage'] = havePackage;
    map['isSync'] = isSync;
    map['isSyncName'] = isSyncName;
    map['nurseLevelName'] = nurseLevelName;
    map['packageConfId'] = packageConfId;
    map['packageConfName'] = packageConfName;
    map['packageLabel'] = packageLabel;
    map['packageLabelName'] = packageLabelName;
    map['roomInfo'] = roomInfo;
    map['startValidDate'] = startValidDate;
    map['statusMasterId'] = statusMasterId;
    map['statusMasterIdName'] = statusMasterIdName;
    map['updatedByName'] = updatedByName;
    return map;
  }

}

/// menuId : 1412
/// menuName : "周菜单11.13-11.19(900)配送"
/// siteId : 10
/// siteName : "AB套餐"

class CanUseSiteList {
  CanUseSiteList({
      this.menuId, 
      this.menuName, 
      this.siteId, 
      this.siteName,
  this.useTypeNames,this.useTypeList}){
    initUseType();
  }

  CanUseSiteList.fromJson(dynamic json) {
    menuId = json['menuId'];
    menuName = json['menuName'];
    siteId = json['siteId'];
    siteName = json['siteName'];
    useTypeNames = json['useTypeNames'];
    useTypeList = json['useTypeList'];
    initUseType();
  }

  List<PickerDataWithIdModel> useType = [];

  void initUseType(){
    if((useTypeList??[]).isNotEmpty){
      var nameList = useTypeNames?.split(",")??[];
      useType =  List.generate(useTypeList!.length, (index){
        return PickerDataWithIdModel(pickId: useTypeList![index],pickName: nameList[index]);
      });
    }
  }

  num? menuId;
  String? menuName;
  num? siteId;
  String? siteName;
  String? useTypeNames;
  List<dynamic>? useTypeList;
CanUseSiteList copyWith({  num? menuId,
  String? menuName,
  num? siteId,
  String? siteName,
  String? useTypeNames,
  List<dynamic>? useTypeList
}) => CanUseSiteList(  menuId: menuId ?? this.menuId,
  menuName: menuName ?? this.menuName,
  siteId: siteId ?? this.siteId,
  siteName: siteName ?? this.siteName,
  useTypeNames: useTypeNames ?? this.useTypeNames,
  useTypeList: useTypeList ?? this.useTypeList,
);
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['menuId'] = menuId;
    map['menuName'] = menuName;
    map['siteId'] = siteId;
    map['siteName'] = siteName;
    map['useTypeNames'] = useTypeNames;
    map['useTypeList'] = useTypeList;
    return map;
  }

}